package be.ipl.finito.threads;

import javax.ejb.EJB;
import javax.servlet.ServletContext;

import be.ipl.finito.domaine.Partie;
import be.ipl.finito.exceptions.BizException;
import be.ipl.finito.usecases.GestionParties;
import be.ipl.finito.util.Consts;

public class TimeoutCreation extends Thread {
	public static final long TIMEOUT = Consts.TEMPS_DEBUT_PARTIE;
	public static final long EXPIRED = Consts.TEMPS_INACTIVITE;

	private ServletContext sc;
	private Partie p;
	public TimeoutCreation(ServletContext sc,Partie p) {
		this.sc = sc;
		this.p = p;
	}
	@Override
	public void run() {
		super.run();
		try {
			sleep(TIMEOUT);
			sc.setAttribute(""+p.getId(), false);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
